#./bin/sh

clear

echo "ejecutando sorts por parametro..."

echo " - Shell Sort..."
./tp1 -s "../Enunciado/beowulf.txt" > out_shellsort.aux
if  [ $? != 0 ] ; then
	echo "   error!"
	exit
else
	echo "   OK!"

fi

echo " - Bubble Sort..."
./tp1 -m "../Enunciado/beowulf.txt" > out_bubblesort.aux
if [ $? != 0 ] ; then
	echo "   error!"
	exit
else
	echo "   OK!"
fi ;

echo "comparando..."

diff "out_shellsort.aux" "out_bubblesort.aux" > out_diff.aux

if [[ -s "out_diff.aux" ]] ; then
	echo "   error!"
	exit
else
	echo "   OK!"
fi ;

echo "ejecutando sorts por stdin..."

echo " - Shell Sort..."
./tp1 -s "../Enunciado/beowulf.txt" > out_shellsort.aux
if  [ $? != 0 ] ; then
	echo "   error!"
	exit
else
	echo "   OK!"

fi

echo " - Bubble Sort..."
./tp1 -m "../Enunciado/beowulf.txt" > out_bubblesort.aux
if [ $? != 0 ] ; then
	echo "   error!"
	exit
else
	echo "   OK!"
fi ;

echo "comparando..."

diff "out_shellsort.aux" "out_bubblesort.aux" > out_diff.aux

if [[ -s "out_diff.aux" ]] ; then
	echo "   error!"
	exit
else
	echo "   OK!"
fi ;

echo "borrando archivos auxiliares..."
echo " "
rm "out_shellsort.aux"
rm "out_bubblesort.aux"
rm "out_diff.aux"


